<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>queryURLparam</title>
    <link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/default.min.css'>
    <script src='//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js'></script>
</head>

<body>
    <pre>
        <code style='max-height: 400px;'>
            let url = 'https://www.bilibili.com/video/BV1rV411n72v?p=66&vd_source=fd41b4fb8a4ead1ed0cb12561cf60dac'
            function queryURLparam(_url){
                let index = _url.indexOf('?')
                let newStr = _url.substring(index+1)
                let arr = newStr.split('&')
                console.log(arr);
                let obj = {}
                arr.forEach(item => {
                    let _index = item.indexOf('=')
                    let key = item.substring(0,_index)
                    let value = item.substring(_index + 1)
                    obj[key] = value
                })
                return obj
            }
            // 正则没写 我不会 q_q
            console.log('queryURLparam',queryURLparam(url));
        </code>
     </pre>
    <script> hljs.highlightAll();</script>
    <script>
        let url = 'https://www.bilibili.com/video/BV1rV411n72v?p=66&vd_source=fd41b4fb8a4ead1ed0cb12561cf60dac'
        function queryURLparam(_url) {
            let index = _url.indexOf('?')
            let newStr = _url.substring(index + 1)
            let arr = newStr.split('&')
            console.log(arr);
            let obj = {}
            arr.forEach(item => {
                let _index = item.indexOf('=')
                let key = item.substring(0, _index)
                let value = item.substring(_index + 1)
                obj[key] = value
            })
            return obj
        }
        // 正则没写 我不会 q_q
        console.log('queryURLparam', queryURLparam(url));
    </script>
</body>

</html>